﻿<!-- BEGIN MAIN CONTENT -->
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN: ACCORDION DEMO -->
        <div class="portlet light">
            <div class="portlet-title page-bar">
                <ul class="page-breadcrumb pull-right">
                    <li>
                        <i class="fa fa-home"></i>
                        <a href="#/home.html">管理中心</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="#/GgcmsUsersList.html">用户管理</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="javascript:;" data-ng-bind="$state.current.data.pageTitle"></a>
                    </li>
                </ul>
                <div class="caption font-green-sharp">
                    <i class="icon-note font-green-sharp"></i>
                    <span class="caption-subject bold uppercase" data-ng-bind="$state.current.data.pageTitle"></span>
                </div>
            </div>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal" name="ggcmsForm" role="form" novalidate>
                            <input type="hidden" ng-model="data.Id">
                            <div class="form-body">
                                <div class="row" ng-if="data.Id==0">
                                    <div class="col-md-4 col-md-offset-3">
                                        <label class="mt-checkbox mt-checkbox-outline" ng-click="currentInfo.batchRegister=!currentInfo.batchRegister">
                                            批量注册
                                            <input type="checkbox" ng-model="currentInfo.batchRegister" /><span></span> 
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{'has-error' : ggcmsForm.Userid.$invalid&&!ggcmsForm.Userid.$pristine}" ng-if="!currentInfo.batchRegister">
                                    <label class="col-md-3 control-label">登录ID:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="Userid" minlength="3" maxlength="30" ng-pattern="currentInfo.userIdRegex" class="form-control" placeholder="登录ID:必须是长度为3-30的英文字母或数字" required ng-model="data.Userid">
                                        <div class="help-block" ng-show="ggcmsForm.Userid.$invalid&&!ggcmsForm.Userid.$pristine"> 必须是长度为3-30的英文字母或数字 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{'has-error' : ggcmsForm.Userid.$invalid&&!ggcmsForm.Userid.$pristine}" ng-if="currentInfo.batchRegister">
                                    <label class="col-md-3 control-label">登录ID:</label>
                                    <div class="col-md-9">
                                        <textarea name="Userid" id="Userid" rows="6" class="form-control" required placeholder="登录ID为英文字母或数字,每行一个" ng-model="data.Userid"></textarea>
                                        <div class="help-block" ng-show="ggcmsForm.Userid.$invalid&&!ggcmsForm.Userid.$pristine"> 登录ID为英文字母或数字,每行一个 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{'has-error' : ggcmsForm.Pwd.$invalid&&!ggcmsForm.Pwd.$pristine}">
                                    <label class="col-md-3 control-label">密码:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="Pwd" minlength="3" maxlength="30" class="form-control" placeholder="请输入密码" ng-model="data.Pwd">
                                        <div class="help-block" ng-show="ggcmsForm.Pwd.$invalid&&!ggcmsForm.Pwd.$pristine"> 请输入密码 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{'has-error' : ggcmsForm.UserGroup.$invalid&&!ggcmsForm.UserGroup.$pristine}" ng-if="'2,3,4'.indexOf(data.Usertype)!=-1">
                                    <label class="col-md-3 control-label">用户组:</label>
                                    <div class="col-md-9">
                                        <select required class="form-control input-medium" name="UserGroup" id="UserGroup" ng-model="data.UserGroup" ng-options="kv.Id as kv.Dkey for kv in currentInfo.UserGroup">
                                            <option value="">请选择用户组</option>
                                        </select>
                                        <div class="help-block" ng-show="ggcmsForm.UserGroup.$invalid&&!ggcmsForm.UserGroup.$pristine"> 请选择用户组 </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 control-label">性别:</label>
                                    <div class="col-md-9">
                                        <div class="input-label">
                                            <label class="mt-radio mt-radio-outline">
                                            <input type="radio" value="1" name="Sex" ng-checked="data.Sex==1"  ng-model="data.Sex"/><span></span>
                                            男
                                        </label>
                                            <label class="mt-radio mt-radio-outline">
                                            <input type="radio" value="0" name="Sex" ng-checked="data.Sex==0" ng-model="data.Sex" /><span></span>
                                            女
                                        </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.btnSelectLogo.$invalid&&!ggcmsForm.btnSelectLogo.$pristine}">
                                    <label class="col-md-3 control-label">用户头像:</label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control input-medium inline-block" ng-model="data.Avatar" name="Avatar" id="Avatar" placeholder="可以直接填写Url地址" />
                                        <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,'Avatar')" ng-model="currentInfo.btnSelectLogo" name="btnSelectLogo" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="200KB"> <i class="icon-picture"></i> 选择图片 </button>
                                        <button class="btn green" type="button" name="btnPreviewLogo" ng-if="data.Avatar" ng-click="editSvr.filePreview('Avatar')"> <i class="icon-eye"></i> 预览 </button>
                                        <button class="btn red" type="button" name="btnClearLogo" ng-if="data.Avatar" ng-click="editSvr.fileClear('Avatar')"> <i class="icon-trash"></i> 清除 </button>
                                        <div class="help-block" ng-show="ggcmsForm.btnSelectLogo.$invalid&&!ggcmsForm.btnSelectLogo.$pristine"> 只能上传小于200kb的图片 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{'has-error' : ggcmsForm.Companyid.$invalid&&!ggcmsForm.Companyid.$pristine}" ng-if="'2,3,4'.indexOf(data.Usertype)!=-1">
                                    <label class="col-md-3 control-label">所在企业:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="Companyid" class="form-control" placeholder="选择所在企业" required ng-model="data.Companyid" typeahead-editable="false" uib-typeahead="state as state.Cname for state in getCompanys($viewValue)" typeahead-show-hint="true" typeahead-min-length="0">
                                        <div class="help-block" ng-show="ggcmsForm.Companyid.$invalid&&!ggcmsForm.Companyid.$pristine"> 所在企业 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-class="{'has-error' : ggcmsForm.Usertype.$invalid&&!ggcmsForm.Usertype.$pristine}" ng-if="data.Usertype!='0'&&!currentInfo.batchRegister">
                                    <label class="col-md-3 control-label">用户类型:</label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="Usertype" id="Usertype" ng-model="data.Usertype" ng-options="kv.type as kv.name for kv in sysDicts.userType | filter:{type:'!0'}"></select>
                                        <div class="help-block" ng-show="ggcmsForm.Usertype.$invalid&&!ggcmsForm.Usertype.$pristine"> 请选择用户类型 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="data.Usertype=='0'">
                                    <label class="col-md-3 control-label">用户类型:</label>
                                    <div class="col-md-9">
                                        <span class="form-control">系统管理员</span>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.Realname.$invalid&&!ggcmsForm.Realname.$pristine}">
                                    <label class="col-md-3 control-label">真实姓名:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="Realname" minlength="2" maxlength="30" class="form-control" placeholder="真实姓名" ng-model="data.Realname">
                                        <div class="help-block" ng-show="ggcmsForm.Realname.$invalid&&!ggcmsForm.Realname.$pristine"> 请输入真实姓名 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.PostCode.$invalid&&!ggcmsForm.PostCode.$pristine}">
                                    <label class="col-md-3 control-label">邮政编码:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="PostCode" minlength="2" maxlength="20" class="form-control" placeholder="邮政编码" ng-model="data.PostCode">
                                        <div class="help-block" ng-show="ggcmsForm.PostCode.$invalid&&!ggcmsForm.PostCode.$pristine"> 请输入邮政编码 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.Phone.$invalid&&!ggcmsForm.Phone.$pristine}">
                                    <label class="col-md-3 control-label">联系电话:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="Phone" minlength="2" maxlength="20" class="form-control" placeholder="联系电话" ng-model="data.Phone">
                                        <div class="help-block" ng-show="ggcmsForm.Phone.$invalid&&!ggcmsForm.Phone.$pristine"> 请输入联系电话 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.County.$invalid&&!ggcmsForm.County.$pristine}">
                                    <label class="col-md-3 control-label">省市县/地区:</label>
                                    <div class="col-md-3">
                                        <select class="form-control" name="Province" ng-model="data.Province" ng-options="item[0] as item[1] for item in addressData.province"> 
                                            <option value="">请选择</option>
                                        </select>
                                        <div class="help-block" ng-show="ggcmsForm.County.$invalid&&!ggcmsForm.County.$pristine"> 请选择省市县/地区 </div>
                                    </div>
                                    <div class="col-md-3">
                                        <select class="form-control" name="City" ng-model="data.City" ng-options="item[1] as item[2] for item in addressData.city | filter:cityFilter"><option value="">请选择</option></select>
                                    </div>
                                    <div class="col-md-3">
                                        <select class="form-control" name="County" ng-model="data.County" ng-options="item[1] as item[2] for item in addressData.area | filter:areaFilter"><option value="" >请选择</option></select>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.Address.$invalid&&!ggcmsForm.Address.$pristine}">
                                    <label class="col-md-3 control-label">地址:</label>
                                    <div class="col-md-9">
                                        <input type="text" name="Address" minlength="2" maxlength="30" class="form-control" placeholder="请输入地址" ng-model="data.Address">
                                        <div class="help-block" ng-show="ggcmsForm.Address.$invalid&&!ggcmsForm.Address.$pristine"> 请输入地址 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.Email.$invalid&&!ggcmsForm.Email.$pristine}">
                                    <label class="col-md-3 control-label">Email:</label>
                                    <div class="col-md-9">
                                        <input type="email" name="Email" minlength="2" maxlength="30" class="form-control" placeholder="Email:电子邮件地址" ng-model="data.Email">
                                        <div class="help-block" ng-show="ggcmsForm.Email.$invalid&&!ggcmsForm.Email.$pristine"> 电子邮件地址 </div>
                                    </div>
                                </div>
                                <div class="form-group" ng-if="!currentInfo.batchRegister" ng-class="{'has-error' : ggcmsForm.Status.$invalid&&!ggcmsForm.Status.$pristine}">
                                    <label class="col-md-3 control-label">用户状态</label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="Status" id="Status" ng-model="data.Status" ng-options="kv.type as kv.name for kv in sysDicts.userStatus"></select>
                                        <div class="help-block" ng-show="ggcmsForm.Status.$invalid&&!ggcmsForm.Status.$pristine"> 用户状态 </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-actions">
                                <hr/>
                                <div class="row">
                                    <div class="col-md-12 text-center" ng-if="!currentInfo.batchRegister">
                                        <button class="btn green" ng-click="editSvr.update(data)" ng-disabled="ggcmsForm.$invalid||saveing"> <span class="fa fa-save"></span> 保存</button>
                                    </div>
                                    <div class="col-md-12 text-center" ng-if="currentInfo.batchRegister">
                                        <button class="btn green" ng-click="saveData(data)" ng-disabled="ggcmsForm.$invalid||saveing"> <span class="fa fa-save"></span> 批量注册</button>
                                    </div>
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
        <!-- END: ACCORDION DEMO -->
    </div>
</div>
<!-- END MAIN CONTENT -->
<pic-pre-view url="currentInfo.pic" close="editSvr.previewClose()" ng-if="currentInfo.picShow"></pic-pre-view>